﻿using System.Runtime.Serialization;

namespace ServiceCore.Entity.Core
{
    [Serializable]
    [DataContract]
    public class BaseParam<TRequest, TReponse>
    {
        public BaseParam() { }
        public BaseParam(string errorMsg) { this.ErrorMsg = errorMsg; }

        /// <summary>
        /// id
        /// </summary>
        [DataMember]
        public long Id { get; set; }
        /// <summary>
        /// 入参
        /// </summary>
        [DataMember]
        public TRequest Param { get; set; }        

        /// <summary>
        /// 缓存变量
        /// </summary>
        private Dictionary<string, object> Caches { get; set; } = new Dictionary<string, object>();

        /// <summary>
        /// 错误消息
        /// </summary>
        [DataMember]
        public string ErrorMsg { get; set; } = "";
        /// <summary>
        /// 结果
        /// </summary>
        [DataMember]
        public TReponse Data { get; set; }
        /// <summary>
        /// 动态结果
        /// </summary>
        [DataMember]
        public Dictionary<string, object> Datas { get; set; } = new Dictionary<string, object>();
    }
}
